<template>
    <div></div>
</template>
<script lang="ts" setup>
/**
 * geoJson与wkt都是WebGIS开发中经常用到的格式,二者相互转换
 */
import WKT from 'terraformer-wkt-parser';
let wkts =
    'POLYGON((102.797302689433 36.5936423859273,105.519115206186 29.4789248520356,100.346180647351 19.9699202912212))';
let geojson = {
    type: 'Polygon',
    coordinates: [
        [
            [100.0, 0.0],
            [101.0, 0.0],
            [101.0, 1.0],
            [100.0, 1.0],
            [100.0, 0.0]
        ],
        [
            [100.2, 0.2],
            [100.8, 0.2],
            [100.8, 0.8],
            [100.2, 0.8],
            [100.2, 0.2]
        ]
    ]
};

console.log('wkt转geojson', WKT.parse(wkts));
console.log('geojson转wkt', WKT.convert(geojson));
</script>
<style lang="scss" scoped></style>
